﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<head>
<title>新增问题类型</title>
<style>
.form-control {
	width: 70%;
}
</style>
<script type="text/javascript">
	$(function(){
		$("#problemTypeName").blur(function(){
			var problemTypeName = $("#problemTypeName").val();
			if(problemTypeName == null || problemTypeName == ''){
				alert("问题类型名称不能为空");
				return;
			} 
			
			$.post("${basePath}/problemType/isProblemTypeNameUniq",{problemTypeName:problemTypeName},function(data){
				if(data.code!=200){
					alert("问题类型名称已存在");
				}
			});
		});
	});
	$(function(){
		$("#submitBtn").click(function() {
			$.post("${basePath}/problemType/addProblemType", $("#addProblemTypeForm").serialize(), function(data) {
				if (data.success) {
					window.location.href="${bashPath}/problemType/toProblemTypePage";
				} else {
					alert(data.msg)
				}
			});
		});
	});
	$(function() {
		$("#clearBtn").click(function() {
			// 清空文本框
			$("#problemTypeName").val("");
			$("#problemTypeDesc").val("");
		});
		
		$("#cancelBtn").click(function() {
			window.location.href="${basePath}/problemType/toAddProblemType";
		});
	});
</script>
</head>
<form id="addProblemTypeForm" name="addProblemTypeForm" enctype="multipart/form-data" class="form-horizontal" role="form">
	<div id="clearDiv" class="container">
		<div class="row clearfix">
			<div class="col-md-12 column" style="padding-top:10px">
				<div class="form-group">
					<label for="problemTypeName" class="col-sm-2 control-label">问题类型名称：</label>
					<div class="col-sm-10">
						<input style="width:20%;padding-left: 3px; padding-right: 5px; padding-top: 4px;" class="form-control" id="problemTypeName" name="problemTypeName" type="text" />
					</div>
				</div>
				<div class="form-group">
					<label for="problemTypeDesc" class="col-sm-2 control-label">问题类型说明：</label>
					<div class="col-md-10 column">
						<textarea id="problemTypeDesc" name="problemTypeDesc" style="width: 70%; height: 100px;"></textarea>
					</div>
				</div>
			</div>
			<div class="col-md-8 column">
				<div align="center" class="form-group">
					<button id="submitBtn" type="button" class="btn btn-default">确定</button>
					<button id="cancelBtn" type="button" class="btn btn-default">取消</button>
					<button id="clearBtn" type="button" class="btn btn-default">重置</button>
				</div>
			</div>
		</div>
	</div>
</form>